﻿using GraphDrawing2.V2.Concrete.Model;
using GraphDrawing2.V2.Graph.Model;

namespace GraphDrawing2.V2.Concrete.States
{
    public class DefaultState : IState
    {
        readonly Model2 model;

        IVisualObject hoveredObject;

        public DefaultState(Model2 model)
        {
            this.model = model;
        }

        public void ProcessMouseMove()
        {
            if (hoveredObject != null)
                hoveredObject.ClearHint(StateHints.HOVERED);
            var point = model.ViewPort.ToWorld(model.CanvasModel.MousePosition);
            hoveredObject = model.ElementsModel.HitTest(point).Object;
            if (hoveredObject != null)
                hoveredObject.SetHint(StateHints.HOVERED);
            model.View.UpdateView();
        }

        public void ProcessMouseUp()
        {
        }

        public void ProcessKeyPressed()
        {
        }
    }
}